package com.antonauoja.javaril;

import java.util.ArrayList;
import java.util.Date;

public class RilList {

	private ArrayList<RilItem> theList;
	private Date since;
	
	public RilList() {
		theList = new ArrayList<RilItem>();
	}
	
	public ArrayList<RilItem> getList() {
		return theList;
	}

	public void add(RilItem newItem) {
		theList.add(newItem);		
	}

	public int size() {
		return theList.size();
	}

	public RilItem get(int i) {
		return theList.get(i);
	}

	protected void setDate(Date d) {
		since = d;
	}
	
	public Date getDate() {
		return since;
	}
	
	@Override
	public String toString() {
		String s = "Last updated: " + since.toString() + '\n';
		s += "\nItems: \n\n";
		for (int i = 0; i < theList.size(); i++) {
			s += theList.get(i).toString() + '\n';
		}
		return s;
	}
}
